package net.lesscoding.controller;

import lombok.RequiredArgsConstructor;
import net.lesscoding.Result;
import net.lesscoding.service.AccountTccService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author eleven
 * @date 2025/4/16 14:17
 * @apiNote
 */
@RestController
@RequestMapping("/account")
@RequiredArgsConstructor
public class AccountController {

    private final AccountTccService accountService;

    @PostMapping("/deduct/{userId}/{money}")
    public Result<Integer> deduct(@PathVariable("userId") String userId, @PathVariable("money") BigDecimal money){
        accountService.deduct(userId, money);
        return Result.success();
    }
}
